import 'package:flutter/services.dart';

/// 剪贴板工具类
class ClipboardUtil {
  /// 复制字符串
  static void copyString(String text) async {
    ClipboardData data = ClipboardData(text: text);
    await Clipboard.setData(data);
  }

  /// 获取剪切板文字
  static Future<String?> getClipData() async {
    var data = await Clipboard.getData(Clipboard.kTextPlain);
    return data?.text?.replaceAll('\r\n', '\n').replaceAll('\r', '\n');
  }
}
